package com.ninetaildemonfox.zdl.socialproject.mvp.ui.activity;

import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.hyphenate.easeui.utils.Preferences;
import com.hyphenate.easeui.utils.map.JSONUtils;
import com.kongzue.baseokhttp.HttpRequest;
import com.kongzue.baseokhttp.listener.ResponseListener;
import com.kongzue.baseokhttp.util.Parameter;
import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
import com.kongzue.dialog.interfaces.OnMenuItemClickListener;
import com.kongzue.dialog.util.BaseDialog;
import com.kongzue.dialog.v3.BottomMenu;
import com.kongzue.dialog.v3.CustomDialog;
import com.kongzue.dialog.v3.MessageDialog;
import com.kongzue.dialog.v3.WaitDialog;
import com.ninetaildemonfox.zdl.socialproject.base.BaseActivity;
import com.ninetaildemonfox.zdl.socialproject.R;
import com.ninetaildemonfox.zdl.socialproject.SpApplication;
import com.ninetaildemonfox.zdl.socialproject.mvp.contract.DetaillnterfaceContract;
import com.ninetaildemonfox.zdl.socialproject.mvp.presenter.DetaillnterfacePresenter;
import com.ninetaildemonfox.zdl.socialproject.mvp.ui.adapter.ImageViewAdp3;
import com.ninetaildemonfox.zdl.socialproject.mvp.ui.fragment.DHomeFragment;
import com.ninetaildemonfox.zdl.socialproject.utils.GlideUtils;
import com.ninetaildemonfox.zdl.socialproject.utils.ToastUtil;
import com.ninetaildemonfox.zdl.socialproject.utils.dialog.DialogShow;
import com.ninetaildemonfox.zdl.socialproject.utils.dialog.FlowDialog;
import com.ninetaildemonfox.zdl.socialproject.utils.dialog.PayDialog;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;

import java.util.List;
import java.util.Map;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * @author NineTailDemonFox
 * @date 2019/7/18 15:53
 * 功能描述： 首页Item界面详情
 * 联系方式：1037438704@qq.com
 */
public class DetailInterfaceActivity extends BaseActivity implements DetaillnterfaceContract {

    @BindView(R.id.image_left_finish)
    ImageView imageleftFinish;
    @BindView(R.id.image_head)
    ImageView imageHead;
    @BindView(R.id.text_center)
    TextView textCenter;
    @BindView(R.id.text_right)
    TextView textRight;
    @BindView(R.id.text_evaluate)
    TextView textEvaluate;
    @BindView(R.id.text_her)
    TextView textHer;
    @BindView(R.id.text_chat)
    TextView textChat;
    @BindView(R.id.text_sex_age)
    TextView textSexAge;
    @BindView(R.id.text_tallage)
    TextView textTallage;
    @BindView(R.id.text_birthday)
    TextView textBirthday;
    @BindView(R.id.text_city)
    TextView textCity;
    @BindView(R.id.text_city_view)
    TextView text_city_view;
    @BindView(R.id.text_piease_choose)
    TextView textPieaseChoose;
    @BindView(R.id.text_wx)
    TextView textWx;
    @BindView(R.id.text_qq)
    TextView textQq;
    @BindView(R.id.text_description)
    TextView textDescription;
    @BindView(R.id.ll_dynamic)
    LinearLayout llDynamic;
    @BindView(R.id.text_collection)
    TextView textCollection;
    @BindView(R.id.text_distance)
    TextView textDistance;
    @BindView(R.id.text_her_two)
    TextView textHerTwo;
    @BindView(R.id.text_her_one)
    TextView textHerOne;
    @BindView(R.id.recyclerView)
    RecyclerView recyclerView;
    @BindView(R.id.ll_album_gone)
    LinearLayout llAlbumGone;
    @BindView(R.id.text_album_vip)
    TextView textAlbumVip;
    @BindView(R.id.text_identification)
    TextView textIdentification;
    @BindView(R.id.fl_wx_gone)
    FrameLayout fl_wx_gone;
    @BindView(R.id.fl_gone_qq)
    FrameLayout fl_gone_qq;
    @BindView(R.id.text_void_renzheng)
    TextView text_void_renzheng;
    private DetaillnterfacePresenter presenter;
    private ImageViewAdp3 imagViewAdapter;
    private Drawable drawable, drawableLike;
    private String wx, qq, thisSex;
    private String is_chat, set_info_money, is_pay_chat, account_money, member_id, stringVip, copy, is_comment;
    private int wxqq = 0;
    private int zhgejiemiande = 0;
    private String quanjutype = "";
    public static int xiangce = 0;
    private String jump = "0";
    private String item;
    private View dialogView;
    private AlertDialog alerDialog;
    private TextView textContext, textCenterDialog, textParentDialog;

    @Override
    protected int getLayoutResource() {
        return R.layout.activity_detail_interface;
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        EventBus.getDefault().unregister(this);
    }

    @Subscribe
    @Override
    public void onInitialization(Bundle bundle) {
//        alerDialog = new AlertDialog.Builder(DetailInterfaceActivity.this)
//                .setView(dialogView).create();
//
//        textContext = dialogView.findViewById(R.id.text_context);
//        textCenterDialog = dialogView.findViewById(R.id.text_center);
//        textParentDialog = dialogView.findViewById(R.id.text_parent);


        WaitDialog.show(me, "数据请求中");
        EventBus.getDefault().register(this);
        stringVip = Preferences.getInstance().getString(me, "user", "vip");
        Log.d("stringVip", "=============" + stringVip);
        Bundle extras = getIntent().getExtras();
        member_id = extras.getString("id");
        if (extras.getString("jump") != null) {
            jump = extras.getString("jump");
        }
        if (extras.getString("item") != null) {
            item = extras.getString("item");
            Log.d("ToastUtil", "====================" + item);
        }
        presenter = new DetaillnterfacePresenter(me, this);
        imageleftFinish.setVisibility(View.VISIBLE);
        recyclerView.setLayoutManager(new GridLayoutManager(this, 4));
        imagViewAdapter = new ImageViewAdp3(R.layout.imageview3);
        imagViewAdapter.setCount(1);
        recyclerView.setAdapter(imagViewAdapter);
        imagViewAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                List<Map<String, String>> data = imagViewAdapter.getData();
                PicturePreviewActivity2.start(me, data, position, 2, member_id);
            }
        });
    }

    @Override
    protected void onResume() {
        super.onResume();
        //WaitDialog.show(me, "");
        presenter.getMemberInfo(token, member_id, DHomeFragment.jingdu, DHomeFragment.weidu);
    }

    @OnClick({R.id.image_left_finish, R.id.text_evaluate, R.id.text_chat, R.id.ll_dynamic,
            R.id.text_wx, R.id.text_qq, R.id.text_collection, R.id.text_album_vip})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.image_left_finish:
                finish();
                break;
            case R.id.text_evaluate:
                //我的评价            是否私聊过  1否 2是   私聊过才能评论
                if (is_chat.equals("2")) {
                    //是否评论过      是否评论  1否 2是
                    if (is_comment.equals("1")) {
                        FlowDialog.start(me, member_id, "2", thisSex);
                    } else if (is_comment.equals("2")) {
                        FlowDialog.start(me, member_id, "3", thisSex);
                    } else {
                        ToastUtil.show("网络开小差了~~");
                    }
                } else {
                    ToastUtil.show("你还没约她/他,还不能评论");
                }
                break;
            case R.id.text_chat:
                quanjutype = "1";
                //  普通用户 聊天或社交账号是否支付过   1否 2是
                // 是否vip 1否 2是
                if (!TextUtils.isEmpty(is_pay_chat)) {
                    if (is_pay_chat.equals("2")) {
                        //聊天
                        ChatActivity.start(me, member_id + "m", 1);
                        return;
                    }
                }
                if (getSex.equals("1")) {
                    if (zhgejiemiande == 1) {
                        ChatActivity.start(me, member_id + "m", 1);
                        return;
                    }
                    if (stringVip.equals("2")) {
                        dialogVip("1");
                        return;
                    }
                    if (is_pay_chat.equals("1")) {
                        dialog(account_money, "1", member_id, 0);
                        return;
                    }
                } else {
                    if (getIdentification.equals("1")) {
                        dialog(account_money, "1", member_id, 10);
                        return;
                    } else {
                        liaotian();
                        return;
                    }
                }
                break;
            case R.id.ll_dynamic:
                //动态
                DynameicActivity.start(this, 1, member_id, jump);
                break;
            case R.id.text_wx:
                if (textWx.getText().equals("已隐藏，私聊索取")) {
                    return;
                }
                quanjutype = "1";
                wxqq = 1;
                copy = wx;
                if (zhgejiemiande == 1 || is_pay_chat.equals("2")) {
                    textWx.setText(wx);
                    fuzhi();
                    return;
                }
                if (getSex.equals("1")) {
                    if (stringVip.equals("2")) {
                        dialogVip("2");
                        return;
                    }
                    //wx
                    if (is_pay_chat.equals("1")) {
                        dialog(account_money, "1", member_id, 0);
                        return;
                    }
                } else {
                    if (getIdentification.equals("1")) {
                        dialog(account_money, "1", member_id, 10);
                        return;
                    }
                }
                fuzhi();
                break;
            case R.id.text_qq:
                if (textQq.getText().equals("已隐藏，私聊索取")) {
                    return;
                }
                quanjutype = "1";
                wxqq = 2;
                copy = qq;
                if (zhgejiemiande == 1 || is_pay_chat.equals("2")) {
                    textQq.setText(qq);
                    fuzhi();
                    return;
                }
                if (getSex.equals("1")) {
                    if (stringVip.equals("2")) {
                        dialogVip("2");
                        return;
                    }
                    //qq
                    if (is_pay_chat.equals("1")) {
                        dialog(account_money, "1", member_id, 0);
                        return;
                    }
                } else {
                    if (getIdentification.equals("1")) {
                        dialog(account_money, "1", member_id, 10);
                        return;
                    }
                }
                fuzhi();
                break;
            case R.id.text_collection:
                //收藏
                presenter.addMylike(token, member_id);
                break;
            case R.id.text_album_vip:
                //解锁相册
                if (getSex.equals("1")) {
                    quanjutype = "4";
                    if (stringVip.equals("2")) {
                        dialogVip("3");
                        return;
                    } else {
                        dialog(set_info_money, "4", member_id, 0);
                    }
                } else {
                    dialog(set_info_money, "4", member_id, 1);
                }
                break;
            default:
        }
    }

    private void liaotian() {
        HttpRequest.POST(me, "Index/chat"
                , new Parameter()
                        .add("token", token)
                        .add("cover_member_id", member_id)
                , new ResponseListener() {
                    @Override
                    public void onResponse(String response, Exception error) {
                        if (error == null) {
                            Map<String, String> map = JSONUtils.parseKeyAndValueToMap(response);
                            if (map.get("code").equals("1")) {
                                ChatActivity.start(me, member_id + "m", 1);
                            }
                        }
                    }
                });
    }

    private void fuzhi() {
        //聊天
        MessageDialog.show(me, "是否复制:", copy, "是", "否")
                .setOnOkButtonClickListener(new OnDialogButtonClickListener() {
                    @Override
                    public boolean onClick(BaseDialog baseDialog, View v) {
                        copy(copy);
                        return false;
                    }
                });
    }

    private void dialogVip(String type) {
        presenter.getisPay(token, member_id, type, "1");
    }

    private void dialog(String set_info_money, String type, String memberId, int zhuangtai) {
        CustomDialog.show(this, R.layout.dialog_chat, new CustomDialog.OnBindView() {
            @Override
            public void onBind(final CustomDialog dialog, View v) {
                TextView text_vip = v.findViewById(R.id.text_vip);
                TextView text_title = v.findViewById(R.id.text_title);
                TextView text_context = v.findViewById(R.id.text_context);
                TextView text_private_chat = v.findViewById(R.id.text_private_chat);
                View view_gone = v.findViewById(R.id.view_gone);
                if (zhuangtai == 1) {
                    text_title.setText("解锁" + nickname + "的相册");
                    text_context.setText("想看" + nickname + "的相册,成为会员，免费查看");
                    text_context.setVisibility(View.GONE);
                    text_private_chat.setText("付费解锁(￥" + set_info_money + ")");
                    text_vip.setText("立即认证");
                    text_vip.setVisibility(View.GONE);
                    view_gone.setVisibility(View.GONE);

                } else if (zhuangtai == 10) {
                    if (getSex.equals("1")) {
                        text_title.setText("联系她");
                        text_context.setText("想看他的全部资料和私聊她,成为会员，\n" +
                                "免费私聊");
                    } else {
                        text_title.setText("联系他");
                        text_context.setText("想看他的全部资料和私聊他,认证之后，\n" +
                                "免费私聊");
                    }
                    text_private_chat.setText("付费查看和私聊(￥" + set_info_money + ")");
                    text_vip.setText("立即认证");
                    text_context.setVisibility(View.VISIBLE);
                    text_vip.setVisibility(View.VISIBLE);
                    view_gone.setVisibility(View.VISIBLE);

                } else {
                    if (type.equals("4")) {
                        text_vip.setVisibility(View.VISIBLE);
                        view_gone.setVisibility(View.VISIBLE);
                        text_title.setText("解锁" + nickname + "的相册");
                        text_context.setVisibility(View.GONE);
                        text_private_chat.setText("付费解锁(￥" + set_info_money + ")");
                        text_vip.setText("成为会员，免费解锁相册");
                    } else {
                        text_context.setVisibility(View.VISIBLE);
                        text_private_chat.setText("付费查看和私聊(￥" + set_info_money + ")");
                    }
                }

                if (getSex.equals("1")) {
                    if (getVip.equals("2")) {
                        text_context.setVisibility(View.GONE);
                        text_vip.setVisibility(View.GONE);
                        view_gone.setVisibility(View.GONE);
                    } else {
                        text_context.setVisibility(View.VISIBLE);
                        text_vip.setVisibility(View.VISIBLE);
                        view_gone.setVisibility(View.VISIBLE);
                    }
                }

                TextView text_center = v.findViewById(R.id.text_center);
                text_center.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        dialog.doDismiss();
                    }
                });
                text_private_chat.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        PayDialog.start(me, set_info_money, type, memberId);
                        dialog.doDismiss();
                    }
                });
                text_vip.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        if (getSex.equals("1")) {
                            //购买会员
                            VipActivity.start(me, "1", 1);
                        } else {
                            //认证
                            Intent intent = new Intent(me, AuthenticationCenterActivity.class);
                            Bundle bundle = new Bundle();
                            bundle.putInt("dataSize", 2);
                            intent.putExtras(bundle);
                            startActivity(intent);
                        }
                        dialog.doDismiss();
                    }
                });
            }
        });
    }

    public static void start(Context context, String id) {
        Intent intent = new Intent(context, DetailInterfaceActivity.class);
        Bundle bundle = new Bundle();
        bundle.putString("id", id);
        intent.putExtras(bundle);
        context.startActivity(intent);
    }

    public static void start(Context context, String id, String jump) {
        Intent intent = new Intent(context, DetailInterfaceActivity.class);
        Bundle bundle = new Bundle();
        bundle.putString("id", id);
        bundle.putString("jump", jump);
        intent.putExtras(bundle);
        context.startActivity(intent);
    }

    public static void start(AppCompatActivity context, String id, String jump, int item) {
        Intent intent = new Intent(context, DetailInterfaceActivity.class);
        Bundle bundle = new Bundle();
        bundle.putString("id", id);
        bundle.putString("jump", jump);
        bundle.putString("item", item + "");
        intent.putExtras(bundle);
        context.startActivity(intent);
    }

    String nickname;

    @Override
    public void DetaSuccess(Map<String, String> data) {
        if (data == null) {
            return;
        }

        data.get("identification");//  是否认证  1否 2是
        String identification = data.get("identification");
        // 个人详情设置 1公开 2相册解锁查看
        String set_info = data.get("set_info");
        //  解锁相册是否支付过   1否 2是
        String is_pay_sock = data.get("is_pay_sock");
        //  普通用户 聊天或社交账号是否支付过   1否 2是
        is_pay_chat = data.get("is_pay_chat");
        account_money = data.get("account_money");

        //  是否评论  1否 2是
        is_comment = data.get("is_comment");
        //  是否私聊过  1否 2是   私聊过才能评论
        is_chat = data.get("is_chat");


        //解锁相册所需金额
        set_info_money = data.get("set_info_money");
        // 用户id
        member_id = data.get("id");
        if (imageHead != null) {
            GlideUtils.glideFille(me, data.get("head_pic"), imageHead);
        }
        if (textSexAge != null) {
            textSexAge.setText(data.get("age"));
        }

        // 性别 1男 2女
        if (thisSex != null) {
            thisSex = data.get("sex");
        }

        if (!TextUtils.isEmpty(thisSex)) {
            if (thisSex.equals("1")) {
                drawable = getResources().getDrawable(R.mipmap.icon_boy_my);
                // 相册解锁所需金额
                textAlbumVip.setText("解锁" + data.get("nickname") + "的相册（" + set_info_money + "元）");
            } else if (thisSex.equals("2")) {
                drawable = getResources().getDrawable(R.mipmap.ic_girl_sex);
                // 相册解锁所需金额
                textAlbumVip.setText("解锁" + data.get("nickname") + "的相册（" + set_info_money + "元），会员免费");
            }
        }
        nickname = data.get("nickname");
        if (nickname != null && textCenter != null) {
            textCenter.setText(data.get("nickname"));
        }
        if (drawable != null && textSexAge != null) {
            drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());
            textSexAge.setCompoundDrawables(drawable, null, null, null);
        }
        if (textTallage != null) {
            textTallage.setText(data.get("height"));
            textCity.setText(data.get("city"));
            text_city_view.setText(data.get("now_city"));
            textBirthday.setText(data.get("weight"));
            textPieaseChoose.setText(data.get("expect_ids"));
            // 微信
            wx = data.get("wx");
            if (TextUtils.isEmpty(wx)) {
                textWx.setText("已隐藏，私聊索取");
            } else {
                //  普通用户 聊天或社交账号是否支付过   1否 2是
                if (is_pay_chat.equals("2")) {
                    textWx.setText(data.get("wx"));
                }
                if (getSex.equals("2")) {
                    if (getIdentification.equals("2")) {
                        textWx.setText(data.get("wx"));
                    }
                }
            }

            qq = data.get("qq");//qq
            if (TextUtils.isEmpty(qq)) {
                textQq.setText("已隐藏，私聊索取");
            } else {
                if (is_pay_chat.equals("2")) {
                    textQq.setText(data.get("qq"));
                }
                if (getSex.equals("2")) {
                    if (getIdentification.equals("2")) {
                        textQq.setText(data.get("qq"));
                    }
                }
            }
            // 个人简介
            textDescription.setText(data.get("description"));
            List<Map<String, String>> pics = JSONUtils.parseKeyAndValueToMapList(data.get("pics"));// 相册
            imagViewAdapter.setNewData(pics);
            // 距离
            textDistance.setText("距您大约" + data.get("distance"));

            // 是否收藏 1是 2否
            String is_like = data.get("is_like");
            if (is_like.equals("1")) {
                drawableLike = getResources().getDrawable(R.mipmap.ic_detail_collection_true);
            } else {
                drawableLike = getResources().getDrawable(R.mipmap.ic_detail_collection);
            }
            drawableLike.setBounds(0, 0, drawableLike.getMinimumWidth(), drawableLike.getMinimumHeight());
            textCollection.setCompoundDrawables(null, drawableLike, null, null);


            if (data.get("sex").equals("1")) {
                if (data.get("vip").equals("1")) {
                    textIdentification.setText("非会员");
                    textIdentification.setTextColor(me.getResources().getColor(R.color.white));
                    textIdentification.setBackgroundResource(R.drawable.shape_drawable_my_text_bg_false);
                    text_void_renzheng.setText("他还不是会员");
                } else {
                    textIdentification.setText("会员");
                    textIdentification.setTextColor(me.getResources().getColor(R.color.white));
                    textIdentification.setBackgroundResource(R.drawable.shape_drawable_my_text_bg);
                    text_void_renzheng.setText("他已成为会员");
                }

            } else {
                if (identification.equals("1")) {
                    textIdentification.setText("未认证");
                    text_void_renzheng.setText("她还未通过视频认证真实性");
                    textIdentification.setTextColor(me.getResources().getColor(R.color.text_black));
                    textIdentification.setBackgroundResource(R.drawable.shape_drawable_my_text_bg_false);
                } else {
                    textIdentification.setText("已认证");
                    text_void_renzheng.setText("她已通过视频认证真实性");
                    textIdentification.setTextColor(me.getResources().getColor(R.color.white));
                    textIdentification.setBackgroundResource(R.drawable.shape_drawable_my_text_bg);
                }
            }

            String set_hidden_distance = data.get("set_hidden_distance");
            if (set_hidden_distance.equals("1")) {
                textDistance.setVisibility(View.VISIBLE);
            } else {
                textDistance.setVisibility(View.GONE);
            }

            // 隐藏社交账号  1否 2是

            String set_hidden_account = data.get("set_hidden_account");
            if (set_hidden_account.equals("1")) {
                fl_wx_gone.setVisibility(View.VISIBLE);
                fl_gone_qq.setVisibility(View.VISIBLE);
            } else {
                fl_wx_gone.setVisibility(View.GONE);
                fl_gone_qq.setVisibility(View.GONE);
            }

            //1是男的 2是女的

            if (thisSex == null) {
                return;
            }
            if (thisSex.equals("1")) {
                textHer.setText("他上锁了相册");
                textHerTwo.setText("他的相册");
                textHerOne.setText("他的动态");
                //  普通用户 聊天或社交账号是否支付过   1否 2是

                if (set_info.equals("1")) {
                    recyclerView.setVisibility(View.VISIBLE);
                    llAlbumGone.setVisibility(View.GONE);
                } else {
                    recyclerView.setVisibility(View.GONE);
                    llAlbumGone.setVisibility(View.VISIBLE);
                }
                //                    //  解锁相册是否支付过   1否 2是
                if (is_pay_sock.equals("2")) {
                    recyclerView.setVisibility(View.VISIBLE);
                    llAlbumGone.setVisibility(View.GONE);
                }
            } else {
                textHer.setText("她锁上了相册");
                textHerTwo.setText("她的相册");
                textHerOne.setText("她的动态");
                if (set_info.equals("1")) {
                    recyclerView.setVisibility(View.VISIBLE);
                    llAlbumGone.setVisibility(View.GONE);
                } else {
                    recyclerView.setVisibility(View.GONE);
                    llAlbumGone.setVisibility(View.VISIBLE);
                }
//                    //  解锁相册是否支付过   1否 2是
                if (is_pay_sock.equals("2")) {
                    recyclerView.setVisibility(View.VISIBLE);
                    llAlbumGone.setVisibility(View.GONE);
                }
            }
        }

    }

    @Override
    public void Failed(String msg) {

    }

    @Override
    public void showLoading() {

    }

    @Override
    public void isPay(Map<String, String> data, String type, String do_type) {
//        1查看 2使用
        if (do_type.equals("1")) {
            if (data == null) {
                return;
            }
            if (data.get("vip_count").equals("0")) {
                //付费支付
                dialog(account_money, quanjutype, member_id, 0);
                return;
            }
//            textContext.setText("是否使用剩余次数:" + data.get("vip_count"));
//            textCenterDialog.setOnClickListener(new View.OnClickListener() {
//                @Override
//                public void onClick(View v) {
//                    alerDialog.dismiss();
//                }
//            });
            //原声的dialog
//            textParentDialog.setOnClickListener(new View.OnClickListener() {
//                @Override
//                public void onClick(View v) {
//                    presenter.getisPay(token, member_id, type, "2");
//                    if (type.equals("3")) {
//
//                    } else {
//                        textQq.setText(qq);
//                        textWx.setText(wx);
//                        zhgejiemiande = 1;
//                    }
//                    alerDialog.dismiss();
//                }
//            });
//            alerDialog.show();
//            //立即开通
            Log.w(">>>", "BaseDialog.size: " + BaseDialog.getSize());
            MessageDialog.show(me,
                    "会员",
                    "是否使用剩余次数:" + data.get("vip_count"),
                    "确认", "取消")
                    .setOnOkButtonClickListener(new OnDialogButtonClickListener() {
                        @Override
                        public boolean onClick(BaseDialog baseDialog, View v) {
                            presenter.getisPay(token, member_id, type, "2");
                            if (type.equals("3")) {

                            } else {

                                if (TextUtils.isEmpty(qq)) {
                                    textQq.setText("已隐藏，私聊索取");
                                } else {
                                    textQq.setText(qq);
                                }
                                if (TextUtils.isEmpty(wx)) {
                                    textWx.setText("已隐藏，私聊索取");
                                } else {
                                    textWx.setText(wx);
                                }
                                zhgejiemiande = 1;
                            }
                            return false;
                        }
                    });

        } else {
//            1聊天 2查看社交账号 3解锁相册
            if (type.equals("1")) {
                ChatActivity.start(me, member_id + "m", 1);
            } else if (type.equals("2")) {
                if (!TextUtils.isEmpty(qq)) {
                    textQq.setText(qq);
                }

                if (!TextUtils.isEmpty(wx)) {
                    textWx.setText(wx);
                }
//                WaitDialog.show(me, "");
//                presenter.getMemberInfo(token, member_id, SpApplication.LONGITUDE, SpApplication.LATITUDE);
//                fuzhi();
            } else if (type.equals("3")) {
                recyclerView.setVisibility(View.VISIBLE);
                llAlbumGone.setVisibility(View.GONE);
//                presenter.getMemberInfo(token, id, SpApplication.LONGITUDE, SpApplication.LATITUDE);
            }
        }
    }

    @Override
    public void memberInfor() {
        presenter.getMemberInfo(token, member_id, SpApplication.LONGITUDE, SpApplication.LATITUDE);
        if (item != null) {
            EventBus.getDefault().post(item);
        }
    }
}
